package com.yupi.yupicturebackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

@Getter
public enum PictureReviewStatusEnums {
    UNREVIEWED("待审核", 0),
    REVIEWING("审核中", 1),
    REVIEW_PASS("审核通过", 2);

    private final String text;
    private final Integer value;

    PictureReviewStatusEnums(String text, Integer value) {
        this.text = text;
        this.value = value;
    }

    //根据不同权限拿取不同枚举实例

    /**
     *
     * @param value 枚举值的值
     * @return 枚举实例
     */
    public static PictureReviewStatusEnums getEnumByValue(Integer value) {
        if (ObjUtil.isEmpty(value)){
            return null;
        }
        for (PictureReviewStatusEnums role : values()) {
            if (role.value.equals(value)) {
                return role;
            }
        }
        return null;
    }
}
